#!/bin/bash

if [ -d Downloads ] || mkdir Downloads;then
    cd ~/Downloads
fi
wget https://ghproxy.com/https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
sed -i "s#REMOTE:-https://github.com#REMOTE:-https://ghproxy.com/https://github.com#" install.sh
sh install.sh
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://ghproxy.com/https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://ghproxy.com/https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions



sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/' ~/.zshrc
sed -i "s/plugins=(git)/plugins=(git zsh-syntax-highlighting zsh-autosuggestions)/" ~/.zshrc
echo 'prompt_time() { ' >> ~/.oh-my-zsh/themes/agnoster.zsh-theme
echo '  echo -n "%{%F{red}%}" ' >> ~/.oh-my-zsh/themes/agnoster.zsh-theme
echo '  echo -n "\ue0b2" ' >> ~/.oh-my-zsh/themes/agnoster.zsh-theme
echo '  echo -n "%{%K{red}%}%{%F{white}%}" ' >> ~/.oh-my-zsh/themes/agnoster.zsh-theme
echo '  echo -n " " ' >> ~/.oh-my-zsh/themes/agnoster.zsh-theme
echo '  echo -n "$(date "+%T ")" ' >> ~/.oh-my-zsh/themes/agnoster.zsh-theme
echo '} ' >> ~/.oh-my-zsh/themes/agnoster.zsh-theme
echo 'build_right_prompt() {prompt_time} ' >> ~/.oh-my-zsh/themes/agnoster.zsh-theme
echo RPROMPT='%{%f%b%k%}$(build_right_prompt) '  >> ~/.oh-my-zsh/themes/agnoster.zsh-theme
sed -i "s/prompt_git$/#prompt_git/" ~/.oh-my-zsh/themes/agnoster.zsh-theme
echo "export TERM=xterm-256color" >> ~/.zshrc
echo 'ZSH_DISABLE_COMPFIX="true"' >> ~/.zshrc


echo "POWERLEVEL9K_SHORTEN_STRATEGY=truncate_from_right" >> ~/.p10k.zsh
echo "POWERLEVEL9K_SHORTEN_DELIMITER=''" >> ~/.p10k.zsh
echo "POWERLEVEL9K_SHORTEN_DIR_LENGTH=1" >> ~/.p10k.zsh
echo "POWERLEVEL9K_SHORTEN_APPEND_PREFIX='..'" >> ~/.p10k.zsh
